#include<stdio.h>

static unsigned long Seed = 1;
#define A 48271L
#define M 2147483647

double Random(void)
{
    Seed = (A*Seed)%M;
    return (double) Seed/M;
}

int main() {
    int i,j;
    int array[8];
    for(i=0;i<8;i++){
        array[i] = (int)(Random()*10)%8;
        printf("%d\n", (unsigned)array[i]);
    }
    //printf("%lf\n", Random()*10000000);

    return 0;
}
